package com.webapp.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.webapp.domain.entity.AssessmentData;

@Repository("assessmentDataDAO")
public class AssessmentDataDAO extends AbstractDAO<AssessmentData>{

	public AssessmentData getAssessmentDataByCode(String code){
		return this.get("where assessmentData.code=?",code);
	}
	
	public AssessmentData findAssessmentDataByCode(String code){
		String hql = "from AssessmentData a where a.code = :code";
		Query query = getSession().createQuery(hql).setString("code", code);
		List list = query.list();
		  return (AssessmentData) (list.size() > 0 ? list.get(0) : null);
	}
	
	
}
